#include <TROOT.h>
#include <TLorentzVector.h>
#include <vector>
#include <iostream>

using namespace std;

bool my_cmp(const TLorentzVector &l1, const  TLorentzVector &l2) {

  return l1.Pt() < l2.Pt();

}


int main() {

 using namespace std;

 vector<TLorentzVector> tlv;
 TLorentzVector l1, l2, l3;
 l1.SetPtEtaPhiM(10, 2.4, 0.5, 1); 
 l2.SetPtEtaPhiM(14, 2.4, 0.5, 1); 
 l3.SetPtEtaPhiM(12, 2.4, 0.5, 1); 

 tlv.push_back(l1);
 tlv.push_back(l2);
 tlv.push_back(l3);

 cout << "vector before sort: " << endl;
 for( int i=0; i<(int)tlv.size(); i++ ) {
    cout << "i/pt: " << i << "/" << tlv[i].Pt() << endl;
 } 

 cout << "sortting... " << endl;
 sort(tlv.begin(), tlv.end(), my_cmp);

 cout << "vector after sort: " << endl;
 for( int i=0; i<(int)tlv.size(); i++ ) {
    cout << "i/pt: " << i << "/" << tlv[i].Pt() << endl;
 } 

 return 1;

}

